package com.zcmob.web.admanagement.parser;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class MyXmlResolve extends DefaultHandler {

    private String strVersionCode;
    private String strversion;
    private String strpackage;
    private String iconName;

    public String getIconName() {
        return iconName;
    }

    public void setIconName(String iconName) {
        this.iconName = iconName;
    }

    public String getStrVersionCode() {
        return strVersionCode;
    }

    public void setStrVersionCode(String strVersionCode) {
        this.strVersionCode = strVersionCode;
    }

    public String getStrversion() {
        return strversion;
    }

    public void setStrversion(String strversion) {
        this.strversion = strversion;
    }

    public String getStrpackage() {
        return strpackage;
    }

    public void setStrpackage(String strpackage) {
        this.strpackage = strpackage;
    }

    @Override
    public void characters(char[] ch, int start, int length) throws SAXException {
        // TODO Auto-generated method stub
        super.characters(ch, start, length);
    }

    @Override
    public void endDocument() throws SAXException {
        // TODO Auto-generated method stub
        super.endDocument();
    }

    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        // TODO Auto-generated method stub
        super.endElement(uri, localName, qName);
    }

    @Override
    public void startDocument() throws SAXException {
        // TODO Auto-generated method stub
        super.startDocument();
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        // TODO Auto-generated method stub
        if (qName.equals("manifest")) {
            // GetInfo getInfo=new GetInfo();
            for (int i = 0; i < attributes.getLength(); i++) {
                String strQname = attributes.getQName(i);
                if (strQname.equals("package")) {
                    strpackage = attributes.getValue(strQname);
                }
                if (strQname.equals("android:versionName")) {
                    strversion = attributes.getValue(strQname);
                }
                if (strQname.equals("android:versionCode")) {
                    strVersionCode = attributes.getValue(strQname);
                }
            }
        }

        if (qName.equals("application")) {
            for (int i = 0; i < attributes.getLength(); i++) {
                String strQname = attributes.getQName(i);
                if (strQname.equals("android:icon")) {
                    iconName = attributes.getValue(strQname);
                }
            }
        }
        super.startElement(uri, localName, qName, attributes);
    }

}
